import req from "../utils/https";
//注册验证码
export function getRegistration(mobile){
    return req.get(`/api/pcUser/register/send/code/${mobile}`)
}
//注册接口
    export function getNewRegistered(loginName,code,mobile,password,nickname) {
        let params = new URLSearchParams()
        params.append("loginName", loginName)
        params.append("code", code)
        params.append("mobile", mobile)
        params.append("password", password)
        params.append("nickname", nickname)
        return  req.post(`/api/pcUser/register`,params)
}

//账号密码登录
export function getLogin(username,password,rememberMe) {
    let params = new URLSearchParams()
    params.append("username", username)
    params.append("password", password)
    params.append("rememberMe", rememberMe)
    return  req.post(`/api/pcUser/login`,params)
}

//手机号登录
export function getPhone(mobile,code) {
    let params = new URLSearchParams()
    params.append("mobile", mobile)
    params.append("code", code)
    return  req.post(`/api/pcUser/login/mobile`,params)
}


//手机登录验证码
export function getVerificationCode(mobile){
    return req.get(`/api/pcUser/login/send/code/${mobile}`)
}
//忘记密码的验证码
export function getForgetVerificationCode(loginName,mobile) {
    let params = new URLSearchParams()
    params.append("loginName", loginName)
    params.append("mobile", mobile)
    return  req.post(`/api/pcUser/forgetpassword/send/code`,params)
}
//忘记密码
export function getChangePassword(loginName,password,mobile,code) {
    let params = {
    'loginName':`${loginName}`,
        'password':`${password}`,
        'mobile':`${mobile}`,
        'code':`${code}`
    }
    return  req.post(`/api/pcUser/password/forget`,params)
}
//修改密码
export function ModifyThePassword(oldPassword,newPassword,checkNewPassword,mobile,code) {
    let params = new URLSearchParams()
    params.append("oldPassword", oldPassword)
    params.append("newPassword", newPassword)
    params.append("checkNewPassword", checkNewPassword)
    params.append("mobile", mobile)
    params.append("code", code)
    return  req.post(`/api/pcUser/update/userPassword`,params)
}
//修改 手机号 的验证码
export function modifyCode (mobile){
    return req.get(`/api/pcUser/edit-password/send/code/${mobile}`)
}

//修改昵称
export function modifyNickname(nickname) {
    let params = {
        'nickname':`${nickname}`,
    }
    return  req.post(`/api/pcUser/update/userInfo`,params)
}
//退出登录
export function modifyLogout() {
    return  req.get(`/api/pcUser/logout`)
}

